package org.example;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-10-21
 * 10:39
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        String s11=sc.nextLine();
        int tScore=0;
        int hScore=0;
        while(n!=0){
            String s=sc.nextLine();
            String[] ss=s.split(" ");
            String t=ss[0];
            String h=ss[1];
            int t1=0;
            int h1=0;
            for (int i = 0; i <Math.min(t.length(),h.length()); i++) {
                if(t.charAt(i)>h.charAt(i)){
                    t1++;
                    break;
                }else if(t.charAt(i)<h.charAt(i)){
                    h1++;
                    break;
                }else if(i==Math.min(t.length(),h.length())-1){
                    if(t.length()>h.length()){
                        t1++;
                        break;
                    }else if(t.length()<h.length()){
                        h1++;
                        break;
                    }
                }
            }
            if(t1>h1){
                tScore+=3;
            }else if(t1==h1){
                tScore+=1;
                hScore+=1;
            }else if(t1<h1){
                hScore+=3;
            }
            n--;
        }
        System.out.println(tScore+" "+hScore);
    }
}
